package com.ruoyi.common.net.webSoket;

import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;

import java.util.Map;

/**
 * @author xumh
 * @title: WebSocketHandshakeInterceptor
 * @projectName ruoyi
 * @description: TODO
 * @date 2024/12/1813:56
 */
@Component
public class WebSocketHandshakeInterceptor implements HandshakeInterceptor {
    public WebSocketHandshakeInterceptor() {
    }

    public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler handler, Map<String, Object> map) throws Exception {
        return true;
    }

    public void afterHandshake(ServerHttpRequest arg0, ServerHttpResponse arg1, WebSocketHandler arg2, Exception arg3) {
        System.out.println("===================afterHandshake===================");
    }
}
